
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			.box{
				width: 500px;
				height: 500px;
				background-color: #ffe4c4;
				margin: 0 auto;
				/* 插入图片 */
				background: url(./1.jpg)no-repeat center/cover;	
				/* cover; */
			}
		</style>
	</head>
	<body>
		<div class="box">
			
		</div>
		<script>
			//  获取元素
			const box=document.querySelector('.box');
			box.style.border='1px solid red';
			box.style.borderBottom='1px solid blue';
			// 修改颜色采用小驼峰命名法
			box.style.backgroundColor='#ffa400';
			box.innerHTML="你好我是DOM";
			box.style.marginTop='15px';
			box.style.width='400px';
			// 随机图片显示案例
			function getradom(N,M)
			{
				 return Math.floor(Math.random()*(M-N+1))+N;
			}
			const radom=getradom(1,10);
			box.style.backgroundImage=`url(./${radom}.jpg)`;		
		</script>
	</body>
</html>